//
//  HJDCTimeTableViewCell.m
//  JYHospital
//
//  Created by 胡金东 on 16/5/24.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDCTimeTableViewCell.h"

@implementation HJDCTimeTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.dateLbl = [[UILabel alloc]initWithFrame:CGRectZero];
        self.dateLbl.textColor = [UIColor getColorWithHexNumber:@"848484"];
        self.dateLbl.font = [UIFont systemFontOfSize:19];
        [self addSubview:self.dateLbl];
        
        self.numLbl = [[UILabel alloc]initWithFrame:CGRectZero];
        self.numLbl.textColor = [UIColor getColorWithHexNumber:@"323232"];
        self.numLbl.font = [UIFont systemFontOfSize:15];
        [self addSubview:self.numLbl];
        
        self.weekLbl = [[UILabel alloc]initWithFrame:CGRectZero];
        self.weekLbl.textColor = [UIColor getColorWithHexNumber:@"323232"];
        self.weekLbl.font = [UIFont systemFontOfSize:14];
        [self addSubview:self.weekLbl];
        
        self.stessLbl = [[UILabel alloc]initWithFrame:CGRectZero];
        self.stessLbl.textColor = [UIColor getColorWithHexNumber:@"FFFFFF"];
        self.stessLbl.textAlignment = NSTextAlignmentCenter;
        self.stessLbl.font = [UIFont systemFontOfSize:14];
        [self.stessLbl setRadius:7 borderWith:0 borderColor:nil];
        self.stessLbl.backgroundColor = [UIColor grayColor];
        [self addSubview:self.stessLbl];

        
        self.projectLbl = [[UILabel alloc]initWithFrame:CGRectZero];
        self.projectLbl.textColor = [UIColor getColorWithHexNumber:@"848484"];
        self.projectLbl.font = [UIFont systemFontOfSize:14];
        
        
        [self addSubview:self.projectLbl];
        
        self.btnImage = [[UIImageView alloc]initWithFrame:CGRectZero];
        [self addSubview:self.btnImage];
        
    }
    return self;
}

-(void)layoutSubviews
{
    CGFloat dateX = HJDHorizontalMargin;
    CGFloat dateY = HJDVerticalMargin;
    CGSize dateSize = [_dateLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.dateLbl.font,NSFontAttributeName, nil]];
    self.dateLbl.frame = (CGRect){{dateX,dateY},dateSize};
    
    CGFloat numX = HJDHorizontalMargin;
    CGFloat numY = CGRectGetMaxY(self.dateLbl.frame) + HJDVerticalMargin/2;
    CGSize numSize = [_numLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.numLbl.font,NSFontAttributeName, nil]];
    self.numLbl.frame = (CGRect){{numX,numY},numSize};
    
    CGFloat weekX = CGRectGetMaxX(self.numLbl.frame)+HJDHorizontalMargin;
    CGFloat weekY = numY;
    CGSize weekSize = [_weekLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.weekLbl.font,NSFontAttributeName, nil]];
    self.weekLbl.frame = (CGRect){{weekX,weekY},weekSize};
    
    CGFloat stessX = numX;
    CGFloat stessY = CGRectGetMaxY(self.numLbl.frame) + HJDVerticalMargin/2;
    CGSize stessSize = [_stessLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.stessLbl.font,NSFontAttributeName, nil]];
    self.stessLbl.frame = CGRectMake(stessX,stessY,stessSize.width +10, stessSize.height);
    
    
    CGFloat projectX = CGRectGetMaxX(self.stessLbl.frame)+ 15 ;
    CGFloat projectY = stessY;
    CGSize projectSize = [_projectLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.projectLbl.font,NSFontAttributeName, nil]];
    self.projectLbl.frame = (CGRect){{projectX,projectY},projectSize};
    
    CGFloat btnImageX = HJDWidth - 45 ;
    CGFloat btnImageY = numY;
    CGFloat btnImageW = 25;
    CGFloat btnImageH = 25;
    self.btnImage.frame = CGRectMake(btnImageX, btnImageY, btnImageW, btnImageH);
}




@end
